// Copyright (c)  YISH. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using NSQL.Sharpen;

namespace NSQL.Expressions.Functions
{
    public class StartWithFunction : BaseExpression, IStartWithFunction
    {
        public IExpression Expr { get; set; }
        public IStringExpression Pattern { get; set; }

        public StartWithFunction(IExpression expression, IStringExpression pattern)
        {
            Expr = expression;
            Pattern = pattern;
        }

        public override T Accept<T>(IExpressionVisitor<T> visitor) => visitor.Visit(this);
        public override void Accept(IExpressionVisitor visitor) => visitor.Visit(this);
        public override bool IsValid => Expr.IsValid && Pattern.IsValid;
        protected override IExpression DeepCopy()
        {
            return new StartWithFunction(Expr.DeepClone(), Pattern.DeepClone())
            {
                Tag = Tag
            };
        }
    }
}